package com.outstanding.junit.code;

import com.outstanding.framework.core.BaseEnum;

public enum ResCode implements BaseEnum<ResCode,String> {
	
	success("00000","成功"), 
	paramError("49002","请求参数不合法"),
	voiceSendFail("V0001","语言发送失败"),
	userNotLogin("U0001","用户未登录");
	
	private String code;

	private String name;
	
	private ResCode(String code, String name) {
		this.code = code;
		this.name = name;
	}

	/**
	 * 根据code获取对应枚举
	 * @param code
	 * @return
	 */
	public static ResCode getByCode(String code) {
		ResCode[] array = ResCode.values();
		for (ResCode bd : array) {
			if (bd.getCode().equals(code)) {
				return bd;
			}
		}
		return null;
	}
	
	public void setCode(String code) {
		this.code = code;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
}
